<?php

namespace app\api\validate;

use think\Validate;

class VisitingMaterials extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name'               => 'require',
        'gender'             => 'require|integer|in:1,2',
        'birthday'           => 'require',
        'id_card'            => 'require',
        'return_permit'      => 'require',
        'hk_address'         => 'require',
        'nd_address'         => 'require',
        'hk_mobile'          => 'require',
        'nd_mobile'          => 'require',
        'education'          => 'require|integer|in:1,2,3,4',
        'cognitive_approach' => 'require|integer|in:1,2,3,4,5,6,7,8,9,10,11',
        'is_voter'           => 'require|integer|in:1,2',

    ];
    /**
     * 提示消息
     */
    protected $message = [
        'name.require'               => '請輸入姓名',
        'gender.require'             => '請選擇性別',
        'gender.integer'             => '性別類型錯誤',
        'gender.in'                  => '性別類型錯誤',
        'birthday.require'           => '請選擇出生日期',
        'id_card.require'            => '請填寫香港身份證號碼',
        'return_permit.require'      => '請填寫回鄉證號碼',
        'hk_address.require'         => '請填寫香港地址，若沒有則填寫「無」',
        'nd_address.require'         => '請填寫内地地址，若沒有則填寫「無」',
        'hk_mobile.require'          => '請輸入香港電話，若沒有則輸入 8 個 0',
        'hk_mobile.integer'          => '香港電話僅限數字',
        'nd_mobile.require'          => '請輸入内地電話，若沒有則輸入 8 個 0',
        'nd_mobile.integer'          => '内地電話僅限數字',
        'education.require'          => '請選擇學歷',
        'education.integer'          => '學歷類型錯誤',
        'education.in'               => '學歷類型錯誤',
        'cognitive_approach.require' => '請選擇認知途徑',
        'cognitive_approach.integer' => '認知類型錯誤',
        'cognitive_approach.in'      => '認知類型錯誤',
        'is_voter.require'           => '請選是否選民',
        'is_voter.integer'           => '選民類型錯誤',
        'is_voter.in'                => '選民類型錯誤',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'do'   => ['name', 'gender', 'birthday', 'id_card', 'return_permit', 'hk_address', 'nd_address', 'hk_mobile', 'nd_mobile', 'education', 'cognitive_approach', 'is_voter'],
        'edit' => [],
    ];

}
